﻿using System;
using System.Web.UI;
using System.Data;
using Lib.Controls;
using Lib.Utilities;

public partial class App_form_Daotao_pcgiangday : fpage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            try
            {
                ScriptManager.GetCurrent(this).Services.Add(new ServiceReference("~/Service/wht_nsd.svc"));
                ScriptManager.GetCurrent(this).Services.Add(new ServiceReference("~/Service/wdt_ma.svc"));
                ScriptManager.GetCurrent(this).Services.Add(new ServiceReference("~/Service/wns.svc"));

                DataTable b_dt = new DataTable();
                LibTable.AddNewColumns(ref b_dt, new string[] { "MA", "TEN" });
                LibTable.AddNewRows(ref b_dt, new object[] { "HKI", "Học kỳ I" });
                LibTable.AddNewRows(ref b_dt, new object[] { "HKII", "Học kỳ II" });
                hocky.DataSource = b_dt;
                hocky.DataBind();

                phong.DataSource = ht.FDM_PHONG_LKE();
                phong.DataBind();
                if (Lib.Utilities.Until.NVL(phong.SelectedValue, "") != "")
                {
                    giangvien.DataSource = ns.FSN_NHAN_SU_LKE(LibConvert.ObjectToDouble(phong.SelectedValue));
                }

                b_dt = dm_dt.FDT_HE_DT_LKE();
                loaidt.DataSource = b_dt;
                loaidt.DataBind();

                namhoc.DataSource = dm_dt.FDM_NAM_LKE();
                namhoc.DataBind();

                //BÔMN
                bomon.DataSource = dm_dt.FDT_BO_MON_LKE();
                bomon.DataBind();
                if (Lib.Utilities.Until.NVL(bomon.SelectedValue, "") != "")
                {
                    DataTable b_dt_bm = dm_dt.FDT_MON_LKE(LibConvert.ObjectToDouble(bomon.SelectedValue));
                    monhoc.DataSource = b_dt_bm;
                }
                //KHOA
                if (Lib.Utilities.Until.NVL(loaidt.SelectedValue, "") != "")
                {
                    khoa.DataSource = dm_dt.FDT_KHOA_LKE(loaidt.SelectedValue);
                    khoa.DataBind();
                }

                //Lớp
                if (Lib.Utilities.Until.NVL(namhoc.SelectedValue, "") != "")
                {
                    lopvh.DataSource = dm_dt.Fdt_LOP_VH_LKE(LibConvert.ObjectToDouble(namhoc.SelectedValue));
                    lopvh.DataBind();
                }
                if (lopvh.SelectedIndex >= 0)
                    tenphu.Text = lopvh.Items[lopvh.SelectedIndex].Text;
            }
            catch (Exception ex)
            {
                Lib.Utilities.LibForm.Msg(this.Page, ex.Message);
            }
        }
    }
}